import router from '@system.router';
import prompt from '@system.prompt';

export default {
    data: {
        password_flag: "password",
        password_img01: "/common/images/hide.png",
        password: "",
        phoneNumber:"",
    },
    back(){
        router.back();
    },
    hide() {
        if (this.password_flag == "password") {
            this.password_flag = "text";
            this.password_img01 = "/common/icon/show.png";
        } else if (this.password_flag == "text") {
            this.password_flag = "password";
            this.password_img01 = "/common/icon/hide.png";
        }
    },
    phone(params){
        this.phoneNumber = params.text;
    },
    guess(params) {
        this.password = params.text;
    },

    login(){
        if(this.phoneNumber=="18771157597"&&this.password=="123qwe"){
            prompt.showToast({
                message: "登录成功",
                duration: 2000,
            });
            router.push({
                uri:"pages/index/index",
                params:{
                    phoneNumber:this.phoneNumber,
                    isLogin:true,
                }
            })
        } else{
            prompt.showToast({
                message: "登录失败",
                duration: 2000,
            });
        }
    }
}
